/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.hop.workflow.actions.actionplugins;

import java.util.List;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.Transform;
import org.apache.hop.core.exception.HopTransformException;
import org.apache.hop.core.exception.HopXmlException;
import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
import org.apache.hop.pipeline.transform.ITransformMeta;
import org.apache.hop.pipeline.transform.TransformMeta;
import org.w3c.dom.Node;

/** Meta data for the abort transform. */
@Transform(
    id = "ActionPlugins",
    name = "LLM",
    description = "i18n::ActionPlugins.Description",
    image = "ActionPlugins.svg",
    categoryDescription = "LLM",
    keywords = "i18n::ActionPlugins.keyword",
    documentationUrl = "/pipeline/transforms/ActionLLMPlugins.html")
public class ActionPluginsMeta extends BaseTransformMeta<ActionPlugins, ActionPluginsData>
    implements ITransformMeta {

  private static final Class<?> PKG = ActionPluginsMeta.class; // For Translator

  /** Threshold to abort. */
  @HopMetadataProperty(key = "llm_name")
  private String llmName;

  /** Message to put in log when aborting. */
  @HopMetadataProperty(key = "output_message")
  private String outputMessage;

  @HopMetadataProperty(key = "input_message")
  private String inputMessage;

  public ActionPluginsMeta() {}

  @Override
  public void getFields(
      IRowMeta inputRowMeta,
      String name,
      IRowMeta[] info,
      TransformMeta nextTransform,
      IVariables variables,
      IHopMetadataProvider metadataProvider)
      throws HopTransformException {
    logBasic("[getFields]name===" + name);
  }

  @Override
  public void check(
      List<ICheckResult> remarks,
      PipelineMeta pipelineMeta,
      TransformMeta transforminfo,
      IRowMeta prev,
      String[] input,
      String[] output,
      IRowMeta info,
      IVariables variables,
      IHopMetadataProvider metadataProvider) {
    // See if we have input streams leading to this transform!
    for (String in : input) logBasic("[check]in===" + in);
  }

  @Override
  public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider)
      throws HopXmlException {
    logBasic("[loadXml]getNodeName===" + transformNode.getNodeName());
    super.loadXml(transformNode, metadataProvider);
    // 对值进行特殊处理
  }

  public String getOutputMessage() {
    return outputMessage;
  }

  public void setOutputMessage(String outputMessage) {
    this.outputMessage = outputMessage;
  }

  public String getInputMessage() {
    return inputMessage;
  }

  public void setInputMessage(String inputMessage) {
    this.inputMessage = inputMessage;
  }

  public String getLlmName() {
    return llmName;
  }

  public void setLlmName(String llmName) {
    this.llmName = llmName;
  }
}
